A versatilely high fidelity electric machines emulator for rapid testing of motor controller

Electric machines emulators (EMEs) based on hardware-in-the-loop (HIL), which effectively act as emulators to mimic the actual motor behavior of Interior Permanent Magnet (IPM) machines. EME is frequently used to evaluate motor controller and motor control methodologies prior to development. The inverse magnetization motor model, which is used as the basis for real-time simulation in this paper’s proposal for an electric machine emulator system based on HIL, uses FEA to create the motor model data. The nonlinear features of the motor may be successfully replicated with this motor model, and the accuracy of the electric machine emulator can be enhanced by using a straightforward and trustworthy motor controller. The real-time simulation tool typhoon HIL is used in the study to develop a hardware-in-the-loop simulation platform for an IPM electric machines emulator.


Introduction
IPM are widely used in new energy vehicles, aerospace, ship electric propulsion, wind power generation [1][2][3], because of their simple structure, low loss and convenient control [4,5].Conventional motor testing requires the construction of mechanical test benches, and different parameter types of motors require the construction of special mechanical test pins according to the testing requirements, which require the use of high-power power supplies and consume a lot of electrical energy, and the testing process is tedious and labor-intensive [6,7].
The characteristics of the voltage and current at the motor's stator are the primary objective of a genuine motor test an electric IPM.
Machines emulator is composed of electronic components and a real-time simulation device running the motor model, which can modify the motor parameters and load according to the test requirements.The EME replaces the real motor connected to the motor controller under test, simulates the output characteristics of the motor under different operating conditions at the port, and completes the motor controller test safely and undamaged.In terms of the input port of the test devices, the EME resembles to a genuine motor.In addition, motor control scheme testing at the pre-development stage can help to decrease development time and faults, making electric machines emulator research highly significant for real-world industrial applications [8].
The phrase "virtual motor" was first used in 1998 by H.J. Slater to evaluate motor drives [9].Slater did so in the same year.By comparing the simulation results of the motor simulation with the real motor working conditions, H. J.'s team finalized the design of the hardware structure of the EME and created the mathematical model of the motor in the d-q axis [10].A builtin permanent magnet motor was employed as the simulation object in order to increase the motor's weak magnetic capacity and reduce the need for permanent magnets.
Based on the literature [11], the mathematical model of PMSM based on the d-q coordinate system is applied as the real-time simulation model to simplify the motor model and facilitate the real-time simulation of the electric machines mimicry.Yet since the model is an ideal motor model, it cannot precisely simulate the motor's actual output characteristics.It was determined to use the turning velocity, rotor flux references, and stator current as state variables from the dynamic mathematical model of the motor that was supplied in the literature [12] in the coordinate system.The model is separated by the Euler methodology, which makes the virtual motor model easy to estimate and computationally less demanding.However, the Euler procedure has challenges preserving the stability of the virtual motor simulation output since it stays away from magnetic saturation and parameter variations.The literature [13] investigates the limitations of the closed-loop current control-based electric machine emulator and proposes a linear regulator for the motor model and PI controller.In order to make the electric machine emulator's frequency domain characteristics more similar to those of the simulated target PMSM, the controller avoids closed-loop current control inside of the electric machine emulator; however, the electric machines emulator based on the linear regulator has a higher overshoot.There are some delays that are difficult to completely get away from.Coupled circuit-finite element co-simulation is used in the literature [14,15] to improve the fidelity of the PMSM model.This approach includes a joint parametric and external circuit simulation compared to the model with lumped parameters through real-time simulation of the finite element motor model, where the finite element equations and the circuit equations are synthesized into a matrix equation for a unified solution.This motor modeling process, however, is based on a finite element online simulation with huge data analyzing, poor real-time performance, low computing power, and difficulty applying current simulation gear.By using finite element analysis software to create a look-up table model based on the accurate motor qualities, the literature [16][17][18] supplies a thorough machine model.The motor simulator can successfully emulate the operation of the IPM motor thanks to the look-up table model, which corresponds to the motor in connection with the rotor position, current advance angle, and current and torque deviations.However, the modeling method requires the calculation of the inverse of the voltage input Flux linkage, which leads to unstable values, especially in drive simulation systems with switching devices.The literature [19] describes a field-programmable gate array (FPGA)-based high-bandwidth (>20 kHz) motor emulator (ME) prototype for an AC motor that can accurately simulate motor currents.The literature [20] uses a back-to-back converter design to connect the device under test (DUT) through the link impedance to achieve the development of a motor load simulation platform.The literature [21] proposed a common DC bus configuration ME system with only AC-DC regeneration simulator stage.
To solve the drawback of time-consuming finite element real-time simulation, analyzing the variation of d-q axis Flux linkage with d-q axis current as well as rotor position by finite element and applying the simulation results to the motor simulator by curve fitting function is an effective solution [22].
In order to solve the above problems, a nonlinear motor model with high fidelity, considering IPM magnetic saturation, space harmonics and cross-coupling is proposed in this paper, based on the Flux Linkages of the motor.The core parameters of the motor model are obtained from finite element calculations, and the nonlinear factors such as magnetic saturation, cross-saturation, cross-coupling, and cogging torque are reflected by the nonlinear relationships of inductance, Flux Linkages, and torque with current and rotor position.Compared with other modeling approaches, the motor model proposed in this paper does not require FEA online simulation, and the nonlinear parameters of the motor are stored in tables that can be used offline; and combines the advantages of simple mathematical model form to simplify the derivation of equations and reduce the amount of table data generated by FEA results, which is simple to implement and improves the model accuracy and simulation efficiency.In addition, a simple and reliable current tracking algorithm is used to control the inverter to accurately track the commanded current to ensure the speed and accuracy of the electric machine emulator current tracking.The real-time simulation device running the motor model is connected to the device under test, making up a HIL real-time simulation platform with simple and easy to implement features.
The organization of this paper is as follows.Section 2 presents an overview of the electric machines emulator system architecture.Section 3 presents the theoretical analysis and modeling process based on the Flux Linkages nonlinear motor model.Section 4 presents the electric machines emulator controller design, containing improved internal mode control and the Luenberger torque observer.Section 5 presents the real-time simulation of the proposed system as a means of validation, and the section contains the transient and steady-state experimental results are analyzed and discussed.Section 6 finally concludes this paper.

Overview of the electric machines emulator system
The nonlinear simulation model of a motor serves as the foundation for the electric machine emulator constructed during this research, which produces the needed current by sampling the port voltage as an input variable.This study refers to the EME of this mode as the VTC (Voltage to Current) mode as the three-phase inverter utilized to replicate the electrical characteristics of the motor is similar to a regulated current source in this case.The indicated electric machines emulator in this study aims to evaluate the motor controller and drive inverter in all respects in a lossless environment.
With the goal to emulate the port characteristics of the permanent magnet synchronous motor, Fig 1 shows a three-phase voltage inverter with base L filtering coupled to the driver that will be presented to the test.The rotor winding of the virtual motor is symbolized by the inverter circuit in the structural block diagram of the electric machines emulator, the induced electric potential is constituted by the capacitance of the filtered coupling circuit, the stator inductance is indicated by the inductance L of the filtered coupling circuit, and the internal resistance R of the inductor L is referred to by the virtual permanent magnet synchronous motor.
An architecture that mimics voltage input-current output is chosen for the electric machines simulation system that is suggested in this study.The motor model contains information obtained through finite element simulation and run in the form of an offline look-up table model that is related to the magnetic saturation of the machine, geometrical characteristics, spatial harmonics, etc.The motor modeling principles will be further discussed in Section III.Results of the motor simulation have a high degree of realism and precision since the process of simulation specified in the article employs a dynamic model of the motor.Additionally, a simple L-filter links the controller under test with the motor simulation device.Accurate command current acquisition and port control form the basis of the motor simulator in VTC mode.The proposed motor simulator system in the present study is set using a simple and durable current tracking control method.The next sections supply an explanation of the design process and analysis for the controller in an active control mode.

Conventional PMSM model
The voltage and torque equations for the d-q axis, as described in Eq (1) and Fig 2, are a basis of the conventional modeling approach used for PMSM in the literature.A more standard magnetic circuit model, the conventional motor d-q axis model advantages include easy the calculation and a distinct relationship between motor the features.
Where u d ,u q ,i d ,i q are the voltages and currents in the d-q axis, L d ,L q are the self-inductances in the d-q axis.ψ f is the permanent Flux linkage, R is the motor stator resistance, ω e is the electric angular velocity, and p is the number of pole pairs.
The cross-direct axis inductance parameters of the PMSM are subject to nonlinearity with the change in cross-and direct-axis currents as the conventional PMSM linear modeling is based on the voltage equation noted by self-inductance.The common linear motor model, on the contrary fingers, ignores the saturation of the magnetic circuit and the cross-coupling between parameters and only considers consideration of the air-gap Flux Linkages and the basic component of the inductance.As the result, the actual motor and such a motor model might not appear to be precisely the same.The permanent magnet synchronous motor is a high-order, multivariable, nonlinear, and complex system in actual operation, and the conventional linear model can no longer satisfy the requirements of a high-precision, high-performance motor simulator system.These effects consist of space harmonics, magnetic circuit saturation, cross-saturation, and cross-coupling.Further, the model and its state parameters are too flawless and the simulation time scale in off-line simulation technology does not precisely correspond the actual time, which makes it difficult bringing about the veracity and confidence of simulation conclusions.

Conventional FEA PMSM model
This common model is still mostly in differential form and is commonly referred to as the direct modeling a position of positive magnetization.With the linear motor model, the FEA model can obtain the Flux Linkages as long as the current and rotor position are included.This three-phase look-up table model utilizes a total of 36 differential expressions, three a variety of impedance tables, and nine offline tables.The model has an all-time high parameter the requirement and a poor model simulation efficiency.

Proposed nonlinear PMSM Flux linkages model
In order to solve the above problems, a reverse magnetization PMSM model is proposed in this paper, based on magnetic flux as the state variable.The dynamic block diagram of the motor model is shown in Fig 3.
To describe it more intuitively, the equation of the Flux linkage is rewritten in matrix form.Meanwhile, to account for the cross-coupling effect between inductors, the effect of motor cross mutual inductance is added on this basis, and the matrix form of the Flux linkage equation is finally obtained as shown in Eq (3).
Thus, the voltage equation can be written in the form of Eq (4).
Where the inductance parameters-which are time-varying parameters-are obtained by solving the finite element method which involve the resistance, the permanent Flux linkage, the straight-axis synchronous inductance, the cross-axis synchronous inductance value, the mutual inductance of the cross-axis in the straight-axis, and the mutual inductance of the straight-axis in the cross-axis.The relationship between the inductance and the currents in the cross and straight axes is described through establishing a two-dimensional look-up table while on implementation.
To determine the parameters considering the spatial harmonics, the FEA results, including the rotation angle θ are applied to the PMSM model.Thus, the self-inductance model can be expressed as a function of θ.Therefore, the voltage equation can be rewritten as in Eq (5).
Thus, the effects of both magnetic saturation and spatial harmonic fields are inherently included in the above Flux linkage function.The dynamics equation of the motor can be simplified to Eq (6).
Where u,i and ψ are the vectors of voltage and Flux linkage in the d-axis, q-axis and magnetic field.R and ω are the matrices of resistance and electrical angular velocity.
The incremental inductance matrix L consists of a self-inductance matrix L self and a mutual inductance matrix L mutual , which as shown in Eq (7).
The incremental matrix L is the sum of the self-inductance matrix and the mutual inductance matrix.
The voltage equation is rewritten as Eq (8).
The inverse of the Flux linkage can be further converted to the inverse of the current, which as shown in Eq (9).
The inverse of the inductance matrix is used to determine the inverse of the inductance, which as shown in Eq (10).
The current can be obtained by integrating the current derivative, which as shown in Eq (11).
Since the cross and straight axis mutual inductance is considered, the torque equation is shown in Eq (12).
The voltage equation of a conventional motor can be expressed in multiply differential or integral form, and its numerical calculation takes the form shown in Eq (13).
Based on the above equation, this paper modeling in the integral form first needs to inverse the relationship to get, which is called the inverse magnetization modeling method, and its simulation is faster and more accurate compared to the differential form.Compared with the traditional linear model, the chain-based inverse magnetization PMSM model is shown in Fig 4 can reflect the nonlinear characteristics of the motor magnetic circuit saturation, cross-saturation, cross-coupling, tooth slot torque, etc.; compared with the three-phase finite element look-up table model, the motor Flux linkage model only requires two Flux linkages and two inductance tables, which greatly reduces the number of parameters required for the model, and combines the advantages of simple mathematical model form with the real-time.
Also it fits real-time with advantages of basic mathematical models, improving the effectiveness of model simulation estimates.The motor model in the d-q coordinate system is easier to operate on than the three-phase model, making the HIL system easy and simple to implement.

Nonlinear IPM Flux Linkages model finite element analysis
As shown in Fig 5, a FEA model of the three-phase 8-pole 48-slot IPM was built using the electromagnetic field FEA set max well to create the table look-up model.Table 1 displays the various motor training places, which data comes from Toyota's open source motor data.The 1/8 model is utilized for FEA in the present work, and the material definition, mesh division, and boundary conditions are specified.This is done bearing consideration of the symmetry of the motor model and the two-dimensional simulation length of time.The Flux linkages in the d-q axis are all obtained by a finite look-up table model with equations in Eqs ( 14) and (15).
Phase current amplitude, phase, and rotor position angle are defined as parametric analysis  The finite element calculation yields three finite element inductance matrix models of the built-in permanent magnet synchronous motor and as shown in Fig 6 .For the rotor position angle θ = 30, the chain-current look-up table model is shown in Figs 7 and 8.
A three-dimensional look-up table model of the d-axis inductance versus the d-q axis current at the specific rotor position is displayed in Fig 7, and an analogous path of the q-axis inductance versus the d-q axis current at the same rotor position is shown in Fig 8 .The seventh picture shows the magnetic saturation effect, while Fig 8 shows the spatial harmonics and flux chain torque.Torque ripples exist even in the case of constant d-and q-axis currents or sinusoidal phase currents; however, they cannot be predicted by conventional linear models, in spite of being present in real IPM machines.
A three-dimensional look-up table model of the d-axis flux linkage and the d-q axis current at a given rotor position is shown in Fig 9, and an identical model of the q-axis flux linkage and the d-q axis current at the same rotor position is shown in Fig 10 .Current and flux linkage map to the other monotonically.The building of the current-flux inverse look-up table model has a mathematical basis due to the capability to determine a unique () for a given.

Proposed control design for internal model controller
The motor port current is a non-repetitive transient component during the switching process when the motor operating state changes.The traditional PI controller cannot track the port current in real-time, and there is a steady-state error that is hard to eliminate, making it difficult to achieve the best control effect.A model-based control strategy called internal mode control has been developed for chemical applications.Internal-mode control has a greater suppression of motor parameter determine errors because it comprises mathematical models that forecast the effects brought on by the control output and is insensitive to parameter swings.As a consequence, through integrating the enhanced internal-mode control into the permanent magnet synchronous motor control, the steady-state error created during current tracking can be minimised.the input exactly and the feedback signal has a value of 0.
Eq (16) only C(s) is an unknown quantity.To make the system steady-state error 0, Eq (18) needs to be satisfied.
It can be taken as CðsÞ ¼ G À 1 ðsÞ.The robustness of the system is improved by connecting the low-pass filter L(s) in series, then C(s) can be expressed by Eq (18).
To simplify the design and improve the filtering performance, a low-pass filter with a first- order inertial link is selected, and which is shown Eq (19), with I as the unit matrix.
The adjusted internal mode controller can be expressed by Eq (20).
Substituting the d-q voltage state space equation into the voltage equation of its Laplace change, the internal model controller F(s) can be obtained, as shown in Eq (21).
L d , L s , and R s are the actual motor parameters, and λ is an adjustable parameter.Define t r as the time required for the system to complete the step, then the relationship between t r and λ is shown in Eq (22).
The internal-mode control regulation parameter is only λ.The performance of both the current controller and the decoupling network is limited by the selection of λ.The initial design of the internal mode controller only considered the decoupling capability of the current, and its design did not consider the impact on the rapidity and accuracy of current tracking.Because of the linear relationship between the controller proportional and integral coefficients, and the regulation parameter is only λ, resulting in a small adjustable range of controller parameters, it is difficult to achieve the best control effect.
To solve the problem that the current controller and the decoupling network in the internal mode controller are difficult to reach the optimum at the same time, the internal mode controller is improved and the new internal mode controller is shown in Eq (23) and Fig 12.
The parameter rectification time can be set first λ 1 = λ 2 = λ using Eq (23) to meet the decoupling requirement of the internal-mode controller, and then the control performance and freedom of the controller can be improved by adjusting λ 1 and λ 2 .The new internal-mode controller improves the freedom and flexibility of parameter adjustment, and there is no linear relationship between the proportional and integral coefficients in the controller, which improves the rapidity and stability of current tracking and makes the control and decoupling performance of the controller optimal.

Proposed control design for the luenberger torque observer
Torque fluctuations in permanent magnet synchronous motors can result from vector control position detection errors, current detection errors, errors produced by the inverter, and motor features including Flux linkage harmonics and cogging effects.By sending the observed torque forward to the current loop to provide high frequency pulsing torque to counteract the variations in motor torque, the Lomborg torque observer may be constructed to smooth the system speed.
Since the system's inputs and outputs are discernible, the Lomborg observation utilizes these in order to recreate the observed values of the state variables.
The equation of mechanical motion of the PMSM is Eq (24).
The load torque is not measurable and the speed is measurable.Selected: state quantity and output quantity y = ω m .The general form of its state space is Eq (25).
Eq (25) is replaced by a state space expression.When the control frequency is high and the sampling period is small, it is assumed that the torque is constant in each sampling period to obtain Eq (26).
Where the A matrix is 5 , the C matrix is 1 0 ½ �, and the D matrix is 0. The Romberg observer is as in Eq (27).From Eqs (26) and ( 27) is rewritten to obtain Eq (28).
In order to make the observer converge and stabilize as soon as possible and the deviation between the estimated value of the state variable and the actual value approaches zero, the solutions of the characteristic equation of the observation system must be negative.The characteristic equation of the observer is shown in Eq (30).
Assuming that the eigenvalues of the observer system are α and β, the feedback gain matrix (31) is obtained.
From Eq (29) we can then build the Romberg torque observer.

Experimental setup
In this paper, the real-time simulation device typhoon is used as the core of the real-time simulation and control of the motor simulator, and the real-time simulation of the output characteristics of the motor port is realized by the real-time simulation device typhoon.The experimental platform of the permanent magnet synchronous motor simulator consists of a PC host computer, DIM100 control board and real-time simulation device typhoon The structure of the permanent magnet synchronous motor simulation experimental platform is shown in Fig 13 [23,24].Typhoon, a powerful multi-core processor machine platform, is coupled with real-time simulation technology.In order to perfectly serve the power electronics sector of simulation and testing, Typhoon features particular authority electronics model library, a professional modeling tool suite, high-precision real-time solution algorithms, and a high-speed I/O interface.Typhoon, a real-time simulation tool, characteristics an integrated FPGA solver that processes data in parallel with the system CPU, greatly improving the effectiveness of simulation operations.
It's significant to note that this is the first time that Typhoon HIL has been used to the motor simulator design research.This makes the design more complicated.Typhoon HILL is widely utilized in smart grids, highlighting that it is suitable for usage in new research fields.

Electric machines emulator steady state simulation analysis
The rated power is the motor output power under the best working condition, which is the highest efficiency of the motor, and the rated power is also the working condition recommended by the motor manufacturer, so the rated power can be understood as the most commonly used power of the motor.The purpose of this paper is to study a permanent magnet synchronous motor simulator with high accuracy and stability, all the parameters are chosen from the rated parameters of the motor, and only the transient and steady-state operating conditions of the motor are analyzed experimentally without considering the ultimate operating conditions.The parameters of the motor body are still selected from Table 1.The rated power is 60 KW and the rated speed is 2000 rpm, so the rated load torque is 30 N�m.The motor simulator is used for steady-state experiments at 0 N�m, 10 N�m, 20 N�m, and 30 N�m motor load torque, respectively.
Start the simulation in the host interface of the real-time simulation device typhoon, apply load torque after the motor starts, and set the motor speed to the rated speed of 2000 rpm.Observe the real-time waveform comparison of the AC/DC current and angular velocity of the permanent magnet synchronous motor simulator and the motor.The red line represents the real-time simulation waveform of the motor simulator, and the black line represents the realtime simulation waveform of the real motor module command value.
From Figs 14-17, it is found that the output of the PM synchronous motor simulator follows the commanded values of load and speed better.Comparing the real-time simulation waveform of the direct shaft current i d of the PM synchronous motor simulator and the motor module, the waveform of the motor simulator is slightly more unstable, but the waveform oscillation of the direct shaft current of the motor simulator is ±0.1 A. The direct shaft current of the motor simulator represented by the red waveform is basically the same as that of the actual motor module in terms of value, and the direct shaft current i d of the four loads of the motor simulator is stable at 0.3 A. The relative errors are -0.017%,0.082%, 0.002%, and -0.001%, respectively, which are all less than 5% and meet the requirements of motor control strategy testing.
Observe the real-time simulation waveform of the cross-axis current i q in Figs 14-17.Since the motor is given a load, the cross-axis current is stable at about 0 A, 0.3 A, 0.625 A, and 0.925 A, respectively, and the waveform oscillation of the cross-axis current is ±0.05 A. As the load increases, the value of the cross-axis current i q increases.The values of the cross-axis current of the motor simulator are basically consistent with the motor module, and the relative errors are 4.940%, -0.012%, -0.012%, and 0.0723%, respectively, which are all less than 5% and meet the requirements of the motor control strategy test.
Observe the real-time simulation waveforms of angular velocity in Figs 14-17.Since the output of the actual motor can only output the rotor angular velocity, comparing the rotor angular velocity of the simulated motor with that of the actual motor, the angular velocity is stable at 0.4785 rad/s, 0.478 rad/s, 0.478 rad/s and 0.4778 rad/s under the four torque loads; the four The speed values shown on the oscilloscope are the standard values, and the speed of the motor simulator under four loads are 2005.995rpm, 2007.091rpm, 2003.891rpm and 2003.060rpm after conversion, which are basically consistent with the speed command value of 2000 rpm.The relative errors are 0.3%, 0.355%, 0.195% and 0.153% respectively, which are less than 5%, and the speed of the motor simulator meets the control effect requirements.
The Steady State Simulation results are shown in Table 2. From the analysis of the simulation waveform of steady-state operation, it can be concluded that under the same motor parameters, control strategy and circuit structure, the permanent magnet synchronous motor simulator can accurately simulate the port output characteristics of the real motor and simulate the condition of the real motor driving the load in steady-state operation.

Electric machines emulator transient simulation analysis
The motor speed was maintained at the rated speed of 2000 rpm while the torque load was increased from 0 to 10, 10 to 20, and 20 to 30 during the steady-state operation of the motor simulator, respectively, to simulate and observe the transient operation of the motor during sudden load addition.This was done after providing the accuracy and stability of the steadystate operation of the permanent magnet synchronous motor simulator in the previous section.To determine if the permanent magnet synchronous motor simulator can faithfully replicate the port characteristics of the genuine motor module under the three sudden load situations involving the output waveforms of the motor simulator are still compared to the output waveforms of the motor module.
Figs 18-20 show that the straight shaft current is stable at a value of roughly 0.3 A prior to the addition of a sudden load and that the oscillation's amplitude is 0.08 A. The motor simulator's straight shaft current tracking command value is accurate and stable, and it meets with all control criteria.After a clear fluctuation when a sudden loading condition occurs, the direct shaft current is stabilized at around 0.3 A once more.The adjustment times are all less than 0.02 s, and the relative errors are 1.238%, 0.793%, and 0.506%, respectively.These errors are all less than 5%, satisfying the requirements of the motor control strategy test.
From Figs 18-20, it can be found that the cross-axis current i q is stable at 0 A, 0.32 A and 0.61 A respectively before the sudden load addition, and the oscillation amplitude is ±0.08 A. The stability and accuracy of the cross-axis current tracking command value of the motor simulator meet the control requirements.When the three sudden load conditions occur, the waveform of the cross-axis current i q of the motor simulator and the actual motor module immediately rises and then reverts to a steady-state.The i q overshoot of the actual motor module is higher than the cross-axis current of the motor simulator, and the regulation time of the motor simulator is less than that of the actual motor module.When the load is suddenly added, the regulation time of the cross-axis current in all three sudden load conditions is less than 0.05 s, and the relative errors are -2.665%,-0.005%, and -0.013%, respectively, which errors are all less than 5%, and the adjustment times are all less than 0.03 s, meeting the requirements of the motor control strategy test.
From Figs 18-20, it can be found that the angular velocity of the motor simulator is stable at 0.477 rad/s, 0.481 rad/s, and 0.480 rad/s under the three sudden load conditions, and the angular velocity of the motor simulator is stable at 0.465 rad/s, 0.469 rad/s, and 0.468 rad/s after the sudden load, and the difference of the angular velocity amplitude before and after the sudden load is only 0.465 rad/s, 0.469 rad/s, and 0.468 rad/s.The difference between the angular velocity amplitude before and after the sudden load is only 0.012 rad/s.After the numerical conversion, the speed of the motor simulator after the sudden load is 1949.399rpm, 1966.168rpm, and 1961.976rpm, respectively.The average absolute errors of the motor simulator speed and the set speed are -2.530%,-1.691%, and -1.9012% respectively, which errors are less than 5%, and the adjustment time is less than 0.03 s, meeting the requirements of the motor control strategy test.The Transient State Simulation results are shown in Table 3.

Conclusion
In this research, a general-purpose motor simulator for motor controller and motor control plan testing is introduced.The following are the contributions of this paper: Inverse magnetization motor look-up table model using the Flux Linkages as the state quantity is in this article.By using a finite element simulation, the data of the motor's nonlinear features, such as magnetic saturation and spatial harmonics, are acquired and offline saved in the motor model as a look-up table model for use.The permanent magnet synchronous motor's inverse magnetization look-up table model combines the benefits of a simple mathematical model with high fidelity and detail in illustrating the motor's nonlinear characteristics.

Fig 6 .
Fig 6.Three-dimensional inductor look-up table model.https://doi.org/10.1371/journal.pone.0299371.g006 The internal model feedback controller structure is shown in Fig 11, where R(s), U(s), and Y(s)correspond to the motor current, stator voltage, and stator current, respectively.C(s) is the controller, G(s) is the real model of the control object, and ĜðsÞ is the observed model.Assuming that the observed model is equivalent to the real model, i.e., G(s) = ĜðsÞ, the output follows

Table 1 . IPM Motor parameters.
objects in the electromagnetic field solution set, at step sizes in 20 A, 15˚, and 3˚and ranges of [-10A, 10A], [0,360˚], and [0,90˚], respectively.It enables the mapping relationship between flux linkage, torque, and phase current amplitude and phase to be calculated based on different rotor position angles.For the goal of discovering the three-dimensional table search model of flux linkage-current and torque-current under various rotor position angles, the solving range of FEA and is set to [-10A, -10A], and the solving step is 12 A. https://doi.org/10.1371/journal.pone.0299371.t001